// Town 0: Entrance
// t0Entrance.txt
// This is the town script for the entrance to the High Level Party Maker.
// Basically nothing happens in this town except that the party gets an
// introductory message and gets directed to the various parts of the HLPM.
//
// State 10 is for the portal that allows the party to leave. States 11, 12, and
// 13 are for the stairs.
//
// Flags used:
// 0 0 = 1 party has received intro message to HLPM

begintownscript;

variables;
// Standard vars.
short i,j,k;
string dlgstr;

body;

beginstate INIT_STATE;

	set_crime_tolerance(1);

	// Get rid of those ugly braziers. They're only there for light.
	set_terrain(29,19,0);
	set_terrain(27,13,0);
	
	// Make it impossible to combat-bug one's way up the stairs.
	change_blocked(19,15,1);
	change_blocked(19,16,1);
	change_blocked(19,17,1);
	change_blocked(19,18,1);
	change_blocked(19,19,1);
	change_blocked(20,15,1);
	change_blocked(20,16,1);
	change_blocked(20,17,1);
	change_blocked(20,18,1);
	change_blocked(20,19,1);
	
	change_blocked(26,7,1);
	change_blocked(27,7,1);
	change_blocked(28,7,1);
	change_blocked(29,7,1);
	change_blocked(30,7,1);
	change_blocked(26,8,1);
	change_blocked(27,8,1);
	change_blocked(28,8,1);
	change_blocked(29,8,1);
	change_blocked(30,8,1);
	
	change_blocked(36,15,1);
	change_blocked(36,16,1);
	change_blocked(36,17,1);
	change_blocked(36,18,1);
	change_blocked(36,19,1);
	change_blocked(37,15,1);
	change_blocked(37,16,1);
	change_blocked(37,17,1);
	change_blocked(37,18,1);
	change_blocked(37,19,1);

	// Intro message. Welcome to the HLPM.
if (get_flag(0,0) == 0) {
	set_flag(0,0,1);
	force_instant_terrain_redraw();
	reset_dialog();
	add_dialog_str(0,"Welcome to the High Level Party Maker, an increasingly more general utility for Blades of Avernum! If you wish to make your current party into a higher level party, follow the purple carpet to the north.",0);
	add_dialog_str(1,"But there is plenty else to do here, too! You can head west into the Arena for combat or east into the Shopping Area to shop. Check the signs for other features.",0);
	add_dialog_str(2,"When you are done here, leave through the portal currently beside you.",0);
	run_dialog(1);
	}

break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;

// If the party is in combat mode, tell them to cut it out.
if (is_combat())
	message_dialog("Entering combat mode outside the Arena is NOT recommended.","");

// Punish crime with instant death.
if (get_crime_level() >= 1) {
	kill_char(1000,2,0);
	message_dialog("Crimes in the HLPM are punishable by instant death, as you discover the hard way.","");
	}

break;

beginstate 10; // Portal to exit the scenario.
	reset_dialog();
	add_dialog_str(0,"Are you ready to leave this party maker and enter real scenarios?",0);
	add_dialog_choice(0,"No. I have more to do here.");
	add_dialog_choice(1,"Yes. Bring it on!");
	if (run_dialog(1) == 2)
		end_scenario(2);
	else
		block_entry(1);
break;

beginstate 11; // Stairs up to Library
	reset_dialog();
	add_dialog_str(0,"These stairs lead to the Ability Rune, the Library, and the Level Raiser. What would you like to do?",0);
	add_dialog_choice(0,"Leave.");
	add_dialog_choice(1,"Climb the stairs.");
	if (run_dialog(1) == 1)
		block_entry(1);
	else
		move_to_new_town(1,19,38);
break;

beginstate 12; // Stairs up to Shopping Area
	reset_dialog();
	add_dialog_str(0,"These stairs lead to the Shopping Area. What would you like to do?",0);
	add_dialog_choice(0,"Leave.");
	add_dialog_choice(1,"Climb the stairs.");
	if (run_dialog(1) == 1)
		block_entry(1);
	else
		move_to_new_town(3,21,7);
break;

beginstate 13; // Stairs up to Arena
	reset_dialog();
	add_dialog_str(0,"These stairs lead to the Arena. What would you like to do?",0);
	add_dialog_choice(0,"Leave.");
	add_dialog_choice(1,"Climb the stairs.");
	if (run_dialog(1) == 1)
		block_entry(1);
	else
		move_to_new_town(4,22,12);
break;